package com.liuxia8.part7.innerClass;

import java.util.logging.Logger;

/**
 * Created by weng.junjie on 2017/2/24.
 */
public class Controller {
    private EventSet es = new EventSet();

    public void addEvent(Event c) {
        es.add(c);
    }

    public void run() {
        Event e;
        while ((e = es.getNext()) != null) {
            if (e.ready()) {
               //System.out.printf("es.getIndex()=%s,es.getNext()=%s"+es.getIndex(),es.getNext());
                e.action();
                System.out.println(e.description());
                es.removeCurrent();
            }
        }
    }
}
